require 'rexml/document'
include REXML

xmlfile = File.new("QuizzEmpty.xml")
xmldoc = Document.new(xmlfile)

#puts "Root element : " + xmldoc.elements["Quizz"]
#puts xmldoc.elements["Quizz"]

# This will output all the movie titles.
xmldoc.elements.each("Quizz/QuestionsReponsesResultats") do |e|
  puts "Good answer: " + e.attributes["GoodAnswerId"]
  puts "Bad answer: " + e.attributes["UserAnswer"]
  puts "Question: " + e.elements["Question"].get_text.to_s
  puts "Nb of answer " + e.elements["Reponses"].size.to_s

  counter = 1
  e.elements.each("Reponses") do |f|
    puts "Answer No" + counter.to_s + ": " + f.elements[""].get_text.to_s
    counter = counter + 1
  end
end

